﻿{% load static %}
{% if not competitions %}
    <p><em>You do not manage any competitions.</em></p>
{% else %}
    {% for competition in competitions %}
        <div class="competition-tile full-width">
            <div class="row">
                <input id="competitionID" type="hidden" value="{{ competition.pk }}" />
                <div class="col-sm-3 col-md-2">
                    <div class="img-container">
                        {% if competition.image_url = None %}
                            <img src="{% static 'img/ProfileImageDummy.jpg' %}">
                        {% else %}
                            <img src="{{ competition.image_url }}">
                        {% endif %}
                    </div>
                </div>
                <div class="col-sm-9 col-md-10">
                    <h3>{{ competition.title }}</h3>
                    <p class="organizer">Organized by {{ competition.creator }}</p>
                    <p>{{ competition.description }}</p>
                </div>
            </div>
            <div class="competition-actions" published="{{competition.published}}" class="columns cursor-default myCompetitionButtons">
                <div class="btn-group btn-group-justified">
                    {% if request.user == competition.creator %}
                        <a class="btn btn-sm btn-danger" id="competition-delete-button" href="{% url 'competitions:delete' pk=competition.pk %}">Delete</a>
                    {% endif %}
                    <a class="btn btn-sm btn-primary" href="{% url 'competitions:edit' pk=competition.pk %}">Edit</a>
                    <a class="btn btn-sm btn-success" href="{% url 'competition-publish' pk=competition.pk %}" id="competition-publish-button">Publish</a>
                    <a class="btn btn-sm btn-warning" href="{% url 'competition-unpublish' pk=competition.pk %}" id="competition-unpublish-button">Unpublish</a>
                    <a class="btn btn-sm btn-primary" href="{% url 'my_competition_participants' competition_id=competition.pk %}">Participants</a>
                    <a class="btn btn-sm btn-primary" href="{% url 'my_competition_submissions' competition_id=competition.pk %}">Submissions</a>
                    <a class="btn btn-sm btn-primary" href="/competitions/{{competition.pk}}#results">Leaderboard</a>
                </div>
            </div>
        </div>
    {% endfor %}
{% endif %}
